﻿// See https://aka.ms/new-console-template for more information
using System;
class PrimeMethod
{
    static void Main(string[] args)
    {
        //true代表是素数，false代表已经被筛掉
            bool[] numArray = new bool[101];
            for (int i = 0; i <= 100; i++)
            {
                numArray[i] = true;
            }
        for(int i = 2; i <= Math.Sqrt(100); i++)//从2的倍数开始筛
        {
            if (numArray[i] == true)
            {
                for(int j = 0; i*j < 100; j++)
                {
                    numArray[i*j] = false;
                }
            }
        }
        //打印输出素数
        for(int i = 0; i <= 100; i++)
        {
            if(numArray[i] == true)
                Console.WriteLine(i);
        }
    }
}

